package czh.cocoa.ui;

import czh.cocoa.foundation.NSObject;
import czh.cocoa.graphics.CGPoint;
import czh.cocoa.graphics.CGRect;

public class UITouch extends NSObject {

	public final static int UITouchPhaseBegan = 0;
	
	public final static int UITouchPhaseMoved = 1;
	
	public final static int UITouchPhaseEnded = 2;
	
	public final static int UITouchPhaseCancelled = 3;
	
	private int mPhase;

	private double mTimestamp;
	
	private UIView mView;
	
	private CGPoint mPoint;
	
	private int mPointerIndex;
	
	UITouch(UIView view, CGPoint point, int phase, double timestamp, int pointerIndex) {
		mView = view;
		mPoint = point;
		mPhase = phase;
		mTimestamp = timestamp;
		mPointerIndex = pointerIndex;
	}
	
	public double timestamp() {
		return mTimestamp;
	}
	
	public int phase() {
		return mPhase;
	}
	
	public UIView view() {
		return mView;
	}
	
	public CGPoint locationInView(UIView view) {
		CGPoint location;
		if (mView == view) {
			location = new CGPoint(mPoint);
		} else {
			location = mView.convertPointToView(mPoint, view);
		}
		return location;
	}
	
	public CGPoint previousLocationInView(UIView view) {
		return null;
	}
	
	public int pointerIndex() {
		return mPointerIndex;
	}
	
}
